package org.koon;

public enum RequestMethod {

    GET("GET"),
    POST("POST"),
    HEAD("HEAD"),
    PUT("PUT"),
    TRACE("TRACE"),
    OPTIONS("OPTIONS"),
    PATCH("PATCH");

    private String value;

    RequestMethod(String value) {
        this.value = value;
    }
    public static RequestMethod from(String method) {
        if (method == null) {
            return null;
        }
        switch (method) {
            case "GET":
                return GET;
            case "POST":
                return POST;
            case "HEAD":
                return HEAD;
            case "PUT":
                return PUT;
            case "TRACE":
                return TRACE;
            case "OPTIONS":
                return OPTIONS;
            case "PATCH":
                return PATCH;
            default:
                return null;
        }
    }
}
